<template>
    <hd-login :loginStyle="loginStyle" :fun="beforeLogin"></hd-login>
</template>

<script>
import { mapActions } from 'vuex'
import bg from '@/assets/images/jw_login_bg.jpeg'
export default {
  data () {
    return {
      loginStyle: {
        backgroundImage: 'url(' + bg + ')'
      }
    }
  },
  methods: {
    ...mapActions([
      'getUserInfo'
    ]),
    async beforeLogin () {
      let rest = await this.getUserInfo()
      if (rest.errcode === 0) {
        return true
      } else {
        this.$Message.error('获取用户信息失败')
        return false
      }
    }
  },
  mounted () {
    this.$Modal.info({
      title: '提示',
      content: '<p>政务信息化提报系统访问地址已经迁移到<a href="http://10.40.3.61:36490/jiwei/#/login">http://10.40.3.61:36490/jiwei/#/login</a> ，系统将自动跳转，或点击链接重新登录进行访问</p>',
      okText: '前往',
      onOk: () => {
        window.location.href = 'http://10.40.3.61:36490/jiwei/#/login'
      }
    })
    setTimeout(() => {
      window.location.href = 'http://10.40.3.61:36490/jiwei/#/login'
    }, 3000)
  }
}
</script>
<style  lang="less">
    .login{
        display: flex;
        justify-content: center;
        align-items: center;
        background-size: 100% 100% !important;
        .login-con{
            position: relative !important;
            left: 0;
            top: 0;
            transform: translateY(0);
            display: none;
        }
    }
    .ivu-modal{
        top: calc((100% - 200px) / 2);
    }
</style>
